package com.wonders.cyxtjsonupdate;

import com.sun.org.apache.bcel.internal.generic.NEW;
import com.wonders.cyxtjsonupdate.service.CyxtJsonData;
import org.junit.jupiter.api.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.jdbc.core.JdbcTemplate;

import java.text.SimpleDateFormat;
import java.util.*;

/**
 * @Description:
 * @ClassName: testdata
 * @Author: 陈兆庆
 * @Date: 2022/1/12 11:23
 * @Version: 1.0     // 版本
 */
@SpringBootTest
class testdata {
    @Autowired
    CyxtJsonData cyxtJsonData;

    @Autowired
    @Qualifier("primaryJdbcTemplate")
    public JdbcTemplate primaryJdbcTemplate;

    @Autowired
    @Qualifier("secondaryJdbcTemplate")
    public JdbcTemplate secondaryJdbcTemplate;


    private static final Logger log = LoggerFactory.getLogger(CyxtJsonData.class);

    @Test
    void test01() {
        long start = System.currentTimeMillis();
        ArrayList<Integer> list1 = new ArrayList<>();
        list1.add(1);
        list1.add(2);
        list1.add(3);
        ArrayList<Integer> list2 = new ArrayList<>();
        list2.add(1);
        list2.add(2);
        list2.add(3);
        ArrayList<Integer> list = new ArrayList<>();
        list.addAll(list1);
        list.addAll(list2);
        long end = System.currentTimeMillis();
        log.info("数据执行时间{}",end-start);
        System.out.println(list);
    }

    @Test
    void test02(){
        String data = cyxtJsonData.buildTotal();
        System.out.println(data);
    }

    @Test
    void test03(){
        int year=2021;
        int month=11;
        String sql = "select MONTHSUM from T_TRAFFIC_STATISTICS@Dw where indicatorType ='taxi_kyl' and YM like" + "'" +year + "%" + "'order by YM";

        System.out.println(sql);

    }
}
